import request from '@/utils/request'

// 根据id查询企业
export const getCompanyById = (id) => request({
  url: `/company/${id}`
})

// 获取所有角色列表
export const getRoleList = (params) => request({
  url: `/sys/role`,
  params
})

// 根据ID删除角色
export const delRole = (id) => request({
  url: `/sys/role/${id}`,
  method: 'delete'
})

// 添加角色
export const addRole = (data) => request({
  url: `/sys/role`,
  method: 'post',
  data
})

// 根据ID获取角色详情
export const getRoleDetail = (id) => request({
  url: `/sys/role/${id}`
})

// 根据ID更新角色
export const editRole = (data) => request({
  url: `/sys/role/${data.id}`,
  method: 'put',
  data
})

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
